package 模拟真题;

/**
 * @author ShadowLim
 * @create 2022-03-24-18:16
 */
public class 最2数字 {

    public static void main(String[] args) {
        int cnt = 0;
        for (int i = 1; i <= 2021; i++) {
            int temp = i;
            while (temp != 0) {
                if (temp % 10 == 2) {
                    cnt++;
                    break;
                }
                temp /= 10;
            }
        }
        System.out.println(cnt);    // 564
    }
}
